#include <iostream>
#include "../../mqserver/route.hpp"
#include <vector>
using namespace std;
using namespace NS_Route;
int main()
{
    std::vector<std::string> bkeys = {
        "aaa",
        "aaa.bbb",
        "aaa.bbb",
        "aaa.bbb",
        "aaa.bbb.ccc",
        "aaa.*",
        "aaa.*.bbb",
        "*.aaa.bbb",
        "#",
        "aaa.#",
        "aaa.#",
        "aaa.#.ccc",
        "aaa.#.ccc",
        "aaa.#.ccc",
        "#.ccc",
        "#.ccc",
        "aaa.#.ccc.ccc",
        "aaa.#.bbb.*.bbb"};
    std::vector<std::string> rkeys = {
        "aaa",
        "aaa.bbb",
        "aaa.bbb.ccc",
        "aaa.ccc",
        "aaa.bbb.ccc",
        "aaa.bbb",
        "aaa.bbb.ccc",
        "aaa.bbb",
        "aaa.bbb.ccc",
        "aaa.bbb",
        "aaa.bbb.ccc",
        "aaa.ccc",
        "aaa.bbb.ccc",
        "aaa.aaa.bbb.ccc",
        "ccc",
        "aaa.bbb.ccc",
        "aaa.bbb.ccc.ccc.ccc",
        "aaa.ddd.ccc.bbb.eee.bbb"};
    std::vector<bool> result = {
        true,
        true,
        false,
        false,
        true,
        true,
        false,
        false,
        true,
        true,
        true,
        true,
        true,
        true,
        true,
        true,
        true,
        true};

    for (int i = 0; i < bkeys.size(); i++)
    {
        // cout << bkeys[i] << " " << rkeys[i] << endl;
        // bool res = Router::isMatch(NS_Message::ExchangeType::TOPIC, bkeys[i], rkeys[i]);
        // std::cout << "匹配结果：" << res << "正确答案：" << result[i] << std::endl << std::endl;

        std::cout << (Router::isMatch(NS_Message::ExchangeType::TOPIC, bkeys[i], rkeys[i]) == result[i]) << std::endl << std::endl;
    }
    return 0;
}